import { stringify } from 'qs';
import request from '@utils/request';

export default {
  query({ page = 1, size = 10 }) {
    return request(`/api/cms/comment?${stringify({ page, size })}`);
  },

  add({ topicId, topicType, content }) {
    return request('/api/cms/comment', {
      method: 'POST',
      body: {
        topicId,
        topicType,
        content,
      },
    });
  },

  update({ id, topicId, topicType, content }) {
    return request(`/api/cms/comment/${id}`, {
      method: 'PUT',
      body: {
        id,
        topicId,
        topicType,
        content,
      },
    });
  },

  remove({ id }) {
    return request(`/api/cms/comment/${id}`, {
      method: 'DELETE',
    });
  },
};
